<template>
  <div class="school">
    <h2>名称：{{ name }}</h2>
    <h2>地址：{{ age }}</h2>
    <h2>名称：{{ num }}</h2>
    <button @click="add"> num++</button>
    <button @click="sendstudentname">studentname</button>
    <button @click="unbind">解绑</button>
    <button @click="dis"> 销毁</button>
  </div>
</template>

<script>
export default {
  name: "student",
  data() {
    return {
      name: "789852",
      age: "456",
      num:0
    };
  },
  methods: {
    sendstudentname(){
    this.$emit("gyl",this.name,666,888)
    this.$emit("demo")
    },
    unbind(){
      //this.$off("gyl")//解绑一个
      this.$off(["gyl","demo"])//解绑多个
      //this.$off()//解绑全部
    },
    dis(){
      this.$destroy()
    },
    add(){
      this.num++
      console.log("0")
    }
  }
};
</script>

<style scoped>
.school {
  background-color: greenyellow;
  padding: 5px;
  margin-top: 30px;
}
</style>
